<?php

use App\Http\Controllers\Merchant\AuthController;
use Illuminate\Support\Facades\Route;

// 游客
Route::middleware('guest')->group(function () {
    // 登录
    Route::get('auth/login', [AuthController::class, 'login'])->name('login');
    Route::post('auth/login', [AuthController::class, 'loginSubmit'])->name('loginSubmit');
    // 注册
    Route::get('auth/register', [AuthController::class, 'register'])->name('register');
    Route::post('auth/register', [AuthController::class, 'registerSubmit'])->name('registerSubmit');
    // 忘记密码
    Route::get('auth/forget-password', [AuthController::class, 'forgetPassword'])->name('forget-password');
    Route::post('auth/forget-password', [AuthController::class, 'forgetPasswordSubmit'])->name('forgetPasswordSubmit');
    // 重置密码
    Route::get('auth/reset-password', [AuthController::class, 'resetPassword'])->name('reset-password');
    Route::post('auth/reset-password', [AuthController::class, 'resetPasswordSubmit'])->name('resetPasswordSubmit');
});

Route::get('/', function () {
    return redirect()->route('merchant.login'); // 使用命名路由
})->name('welcome');


Route::middleware(['auth_admin'])->group(function () {
    Route::get('logout', [AuthController::class, 'logout'])->name('logout');
});
